package com.eascs.web.o2o.web.aging.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.alibaba.dubbo.config.annotation.Service;
import com.eascs.web.o2o.web.aging.service.DicDataDao;
import com.eascs.web.o2o.web.aging.service.SysPermissionService;
import com.eascs.workflow.common.entity.wf.DicData;

@Service
public class SysPermissionServiceimpl implements SysPermissionService {

	@Autowired
	private DicDataDao dicDataDao;
	
	@Override
	public List<DicData> getDicDataByType(String dataType) {
		return dicDataDao.getDicDataByType(dataType);
	}
	
	/*
	@Override
	public ModelResult<List<SysResources>> queryResourcesByUser(SysUser user) {
		return sysPermissionServiceInlet.queryResourcesByUser(user);
	}
	@Override
	public ModelResult<List<SysResources>> selectResourcesList() {
		return sysPermissionServiceInlet.selectResourcesList();
	}
	@Override
	public ModelResult<List<SysResources>> selectDefaultResourcesList() {
		ModelResult<List<SysResources>> modelResult=new ModelResult<List<SysResources>>();
    	try {
    		List<SysResources> res=sysResourcesDao.selectDefaultResourcesList();
    		modelResult.setModel(res);
    		return modelResult;
		} catch (Exception e) {
			 modelResult.withError("SysPermissionServiceImpl.selectResourcesList", "获取资源列表失败:"+e.getMessage());
			 return modelResult;
		}
	}
	@Override
	public ModelResult<List<SysResources>> selectUnDefaultResourcesList() {
		ModelResult<List<SysResources>> modelResult=new ModelResult<List<SysResources>>();
    	try {
    		List<SysResources> res=sysResourcesDao.selectUnDefaultResourcesList();
    		modelResult.setModel(res);
    		return modelResult;
		} catch (Exception e) {
			 modelResult.withError("SysPermissionServiceImpl.selectResourcesList", "获取资源列表失败:"+e.getMessage());
			 return modelResult;
		}
	}
	@Override
	public ModelResult<SysResources> insertResources(SysResources sysResources) {
		return sysPermissionServiceInlet.insertResources(sysResources);
	}
	@Override
	public ModelResult<Integer> updateResources(SysResources sysResources) {
		if (sysResources.getId().equals(sysResources.getParentId())) {
			return null;
		}
		return sysPermissionServiceInlet.updateResources(sysResources);
	}
	@Override
	public ModelResult<Integer> deleteResources(SysResources sysResources) {
		return sysPermissionServiceInlet.deleteResources(sysResources);
	}
	@Override
	public ModelResult<PageResult<Object[]>> selectRolesPage(SysRole param,int pageSize,int pageIndex) {
		return sysPermissionServiceInlet.selectRolesPage(param, pageSize, pageIndex);
	}
	@Override
	public ModelResult<SysRole> selectRolesByRole(SysRole sysRole) {
		return sysPermissionServiceInlet.selectRolesByRole(sysRole);
	}
	@Override
	public ModelResult<Integer> insertRole(SysRole sysRole) {
		return sysPermissionServiceInlet.insertRole(sysRole);
	}
	@Override
	public ModelResult<SysRole> insertRoleReturnRole(SysRole sysRole) {
		ModelResult<SysRole> modelResult=new ModelResult<>();
		sysPermissionServiceInlet.insertRole(sysRole);
		modelResult.setModel(sysRole);
		return modelResult;
	}
	
	@Override
	public ModelResult<Integer> deleteRole(SysRole sysRole) {
		return sysPermissionServiceInlet.deleteRole(sysRole);
	}
	@Override
	public ModelResult<Integer> updateRole(SysRole sysRole) {
		return sysPermissionServiceInlet.updateRole(sysRole);
	}
	@Override
	public ModelResult<Integer> insertRoleResBatch(List<SysRoleResources> roleResList) {
		return sysPermissionServiceInlet.insertRoleResBatch(roleResList);
	}
	@Override
	public ModelResult<List<SysResources>> selectResourcesByRoles(SysRole role) {
		return sysPermissionServiceInlet.selectResourcesByRoles(role);
	}
	
	@Override
	public ModelResult<PageResult<OrgUserRoleVo>> searchOrgUserRolePage(Map<String, String> param, int pageSize, int pageIndex) {
		return sysPermissionServiceInlet.searchOrgUserRolePage(param, pageSize, pageIndex);
	}
	
	@Override
	public ModelResult<PageResult<User>> searchEmployeePage(Map<String, String> param, int pageSize,
			int pageIndex) {
		return sysPermissionServiceInlet.searchEmployeePage(param, pageSize, pageIndex);
	}
	
	@Override
	public ModelResult<List<ActOrgEntity>> getOrgListByLevel(String parentId, int level){
		return sysPermissionServiceInlet.getOrgListByLevel(parentId, level);
	}
	
	@Override
	public ModelResult<List<SysRole>> getRoleList() {
		return sysPermissionServiceInlet.getRoleList();
	}
	
	@Override
	public ModelResult<User> getSysUserById(String userNo) {
		return sysPermissionServiceInlet.getSysUserById(userNo);
	}
	
	@Override
	public ModelResult<SysRole> getRoleById(String roleId){
		return sysPermissionServiceInlet.getRoleById(roleId);
	}
	
	@Override
	public ModelResult<Integer> saveOrUpdateOrgUserRole(ActOrgRoleUserEntity orgRoleUserEntity) {
		return sysPermissionServiceInlet.saveOrUpdateOrgUserRole(orgRoleUserEntity);
	}
	
	@Override
	public ModelResult<Integer> delUserRole(String id) {
		return sysPermissionServiceInlet.delUserRole(id);
	}
	
	@Override
	public ModelResult<List<ActOrgRoleUserEntity>> getUserRoleList(String userNo) {
		return sysPermissionServiceInlet.getUserRoleList(userNo);
	}*/
	
	
	
	/*@Override
	public ModelResult<Boolean> checkIsAdmin(String userNo) {
		return sysPermissionServiceInlet.checkIsAdmin(userNo);
	}
	
	@Override
	public ModelResult<Boolean> checkAuth(String userNo, String roleCode) {
		return sysPermissionServiceInlet.checkAuth(userNo, roleCode);
	}
	@Override
	public List<SysResources> selectResourcesListByCode(String code) {
		return sysResourcesDao.selectResourcesListByCode(code);
	}
	@Override
	public PageResult<Object[]> selectOrgRoleUserPage(ActOrgRoleUserEntity obj, int pageSize, int pageIndex) {
		return sysOrgRoleUserDao.selectOrgRoleUserPage(obj, pageSize, pageIndex);
	}
	@Override
	public ModelResult<List<Object[]>> getOperatorList(String userName) {
		return sysPermissionServiceInlet.getOperatorList(userName);
	}
	@Override
	public ModelResult<List<Object[]>> getOperatorListByRoleCode(String userName, String roleCode) {
		return sysPermissionServiceInlet.getOperatorListByRoleCode(userName, roleCode);
	}
	
	@Override
	public ModelResult<List<Object[]>> getLikeEmployeeList(String employeeName) {
		return sysPermissionServiceInlet.getLikeEmployeeList(employeeName);
	}
	@Override
	public Integer insertOrgUserRoleByempno(User user,String employeeNo, String roleId, String orgId) {
		return sysOrgRoleUserDao.insertOrgUserRoleByempno(user,employeeNo, roleId, orgId);
	}
	@Override
	public ModelResult<List<User>> getUserWithRoleCode(String roleCode) {
		ModelResult<List<User>> modelResult=new ModelResult<List<User>>();
		List<User> userList = sysOrgRoleUserDao.getUserWithRoleCode(roleCode);
		modelResult.setModel(userList);
		return modelResult;
	}
	@Override
	public ModelResult<List<User>> getUserWithUnitNoAndRoleCode(String unitNo, List<String> roleCodeList) {
		ModelResult<List<User>> modelResult=new ModelResult<List<User>>();
		List<User> userList = sysOrgRoleUserDao.getUserWithUnitNoAndRoleCode(unitNo, roleCodeList);
		modelResult.setModel(userList);
		return modelResult;
	}
	
	@Override
	public SysResources getResourcesByIds(String ids) {
		return sysResourcesDao.getResourcesByIds(ids);
	}
	@Override
	public int update(SysResources sysResources) {
		 if (sysResources.getId().equals(sysResources.getParentId())) {
				return 0;
			}
		 return sysResourcesDao.updateResources(sysResources);
	}
	

	@Override
	public PageResult<Object[]> findRolePageByResId(SysResourcesFormEntity entity) {
		return sysResourcesDao.findRolePageByResId(entity);
	}
	
	@Override
	public PageResult<Object[]> findEmployeePageByResId(SysResourcesFormEntity entity) {
		return sysResourcesDao.findEmployeePageByResId(entity);
	}
	@Override
	public ModelResult<List<ActOrgEntity>> getLeafNodeByParentId(String orgId) {
		return sysPermissionServiceInlet.getLeafNodeByParentId(orgId);
	}*/
}
